//because some editors can have different CRLF settings than what we've saved as, we'll only save if the code in the editor has changed. this will prevent update notifications when there are none
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
prefs = prefs.getBranch("extensions.stylish.");
prefs.setBoolPref("wrap_lines", on);
refreshWordWrap(on);
}
function refreshWordWrap(on) {
//bug 41464 (wrap doesn't work dynamically) workaround
codeE.style.display = "none";
codeE.setAttribute("wrap", on ? "on" : "off");
setTimeout("codeE.style.display = '';", 10);
}
function insertChromePath() {
var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var fileHandler = ios.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler);
var chromePath = fileHandler.getURLSpecFromFile(Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("UChrm", Components.interfaces.nsIFile));
insertCodeAtCaret(chromePath);
}
function insertDataURI() {
const ci = Components.interfaces;
const cc = Components.classes;
const nsIFilePicker = ci.nsIFilePicker;
var fp = cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);